/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package model.information;

import java.io.Serializable;
import java.util.Observable;
import java.util.ArrayList;

/**
 * A class that represents an exercise.
 * @author Tobias Møller Kjærsgaard
 * @author Hjalte Blichfeldt Flyger
 * @author Gitte Simonsen
 * @author Claus Lund
 */
public class Exercise extends Observable implements Serializable {

    //////// Fields for class Exercise ////////

    private String name;
    private ArrayList<Set> sets;

    //////// Constructor ////////

    public Exercise(String name) {
        this.name = name;
        sets = new ArrayList<Set>();
    }

    //////// Getters & Setters for exercise ////////

    public ArrayList<Set> getSets() {
        return sets;
    }

    public void setExercise(ArrayList<Set> set) {
        this.sets = set;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    //////// Other methods ////////

    public void addSet(Set set) {
        sets.add(set);
    }

    public void removeSet(Set set) {
        sets.remove(set);
    }

    public int calcWorkload() {
        int value = 0;
        for (Set s: sets) {
            value += (s.getReps()+s.getWeight());
        }
        return value;
    }

}
